package com.chat.client.controller;

import com.chat.client.service.StepService;
import com.chat.client.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;

@RestController
@RequestMapping("/aa")
public class TestaController {

    @Autowired
    StepService stepService;

    @Autowired
    @Qualifier("testTwoServiceImpl")
    TestService testService;
//    private String aa = testService.test();
//    @Autowired
//    public TestaController(TestService testService) {
////        this.testService=testService;
//        setTestService(testService);
//        System.out.println(this.testService.test());;
//    }

//    @Autowired
//    public void setTestService(TestService testService) {
//        this.testService = testService;
//    }

    //测试百威设备删除接口

    @RequestMapping("/test")
//    public Object test(@RequestBody JSONObject jsonbody) {
    public Object test() {
//        System.out.println(JSON.toJSONString(jsonbody));
//        JSONObject result = new JSONObject();
//        result.put("flag", 3);
//        result.put("version", "0.2");
//        result.put("cmd", "delete person(s)");
//        result.put("command_id","1111");
//        return testService.test();
        stepService.a();
        return null;
    }

    public static void main(String[] args) {
//    List<Integer> list = new LinkedList<>();
//    list.add(1);
//    list.add(2);
//    list.add(3);
//    list.add(4);
//    list.forEach(a->{
//        System.out.println(a);
//    });
//   Map result = new LinkedHashMap<>();
        Map result = new TreeMap<>();
        LocalDateTime time = LocalDateTime.now();
        for (int i = 0; i < 24; i++) {
            result.put(time.minusHours(i + 1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH")), "0");
        }
        System.out.println(1);
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {

            }
        });
        thread.start();
    }
}
